package com.hs.hlw.credit.system.business.dto;

import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Autowired;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;

/**
 * SubmissionDto
 * @author zhb
 * @date 2018/11/22
 */
public class SubmissionDto {
    @Data
    public static class Submit {
        @NotNull(message = "未指定表单")
        private Integer formId;
        @NotEmpty(message = "参数未填写")
        Map<String, String> params;
    }

    @Data
    public static class BatchDeleteDraft {
        @NotNull(message = "未指定表单")
        private Integer formId;
        @NotEmpty(message = "未指定要删除的记录")
        List<Id> idList;
    }

    @Data
    public static class BatchSubmitDraft {
        @NotNull(message = "未指定表单")
        private Integer formId;
        @NotEmpty(message = "未指定要提交的记录")
        List<Id> idList;
    }

    @Data
    public static class Id {
        private Integer id;
    }

    @Data
    public static class ErrorMsg {
        private Integer rowNumber;
        private String fieldCode;
        private String fieldName;
        private String errorMsg;
        public ErrorMsg(String fieldCode, String fieldName, String errorMsg) {
            this.fieldCode = fieldCode;
            this.fieldName = fieldName;
            this.errorMsg = errorMsg;
        }
    }
}